import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

public class Customer extends Person {
    private boolean isVIP;
    private double balance;
    private boolean isDining;
    private List<Dish> orderList = new ArrayList<Dish>();
    private List<Dish> noServeList = new ArrayList<Dish>();

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getBalance() {
        return balance;
    }

    public static boolean checkRechargeMoney(String moneyStr) {
        double money = 0;
        if (MyUtil.checkNoNegativeDouble(moneyStr)) {
            money = Double.parseDouble(moneyStr);
            if (money < 100 || money >= 1000) {
                return false;
            }
        } else {
            return false;
        }
        return true;
    }

    public void recharge(String moneyStr) {
        if (!checkRechargeMoney(moneyStr)) {
            System.out.println("Recharge input illegal");
        } else {
            this.balance += Double.parseDouble(moneyStr);
        }
    }

    public void toVip() {
        if (balance >= 200) {
            this.isVIP = true;
            System.out.println("Apply VIP success");
        } else {
            System.out.println("Please recharge more");
        }
    }

    @Override
    public String toString() {
        return String.format("PID:%s,Name:%s,Sex:%c,Phone:%s,PWD:%s", PID, name, sex, phoneNum, PWD);
    }
}
